import 'dart:async';
import 'package:flutter/services.dart';

class CosPlugin {
  static const MethodChannel _channel = const MethodChannel('io.flutter.plugins.CosFlutterActivity');



  static Future<String> get platformVersion async {
    final String version = await _channel.invokeMethod('getPlatformVersion');
    return version;
  }

  //声明plugin加载的方法，参数为url，callback回调，和可选参数Rect（控制）plugin的大小
  Future<Null> launch(String url, Function callback) async {
    Map<String, dynamic> args = {
      "url": url,
    };

    final String result = await _channel.invokeMethod('getBatteryLevel');
    if (callback != null) {
      callback(result);
    }
  }
}
